package util;

import com.alibaba.fastjson.JSON;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Arrays;
import java.util.List;

/**
 * @author 李栋
 * @version 1.0.0
 * @className ArraysTest.java
 * @createTime 2021年08月09日 21:53:00
 */
public class ArraysTest {

    private static final Logger logger = LoggerFactory.getLogger(Arrays.class);


    /**
     * Arrays.sort)
     */
    @Test
    public void arraysSort() {
        int[] arr = {1, 5, 3, 2, 1, 8};
        Arrays.sort(arr);
        logger.info(JSON.toJSONString(arr));
    }

    /**
     * Arrays.asList
     */
    @Test
    public void arraysAsList() {
        int[] arr = {1, 23, 3};
        List<int[]> list = Arrays.asList(arr);
        logger.info(JSON.toJSONString(arr));

        String[] str = {"one", "two"};
        List<String> stringList = Arrays.asList(str);
        logger.info(JSON.toJSONString(stringList));
    }
}
